
<h2 class="tc pv5">
  <?php echo $_cbase['sys_name']; ?> 
  [v<?php echo $_cbase['sys']['ver']; ?>] - 
  <?php lang('tools.setup_title',0); ?>
</h2>

<form id="fmsupset" name="fmsupset" method="post" action="?act=EditDB">
<div>
  <p><?php lang('tools.setup_title',0); ?>-<?php lang('tools.setup_steps',0); ?></p>
  <table width="100%" border="1" class="tblist">
  <tr>
    <th width="20%"><?php lang('tools.setup_step',0); ?></th>
    <th><?php lang('tools.setup_info',0); ?></th>
    <th width="10%"><?php lang('tools.setup_state',0); ?></th>
  </tr>
  
  <?php if($cmynow['res']==FLAGNO){ ?>
  <tr class="tc">
    <td><?php lang('tools.setup_0cfgerror',0); ?></td>
    <td class="msg"><?php echo $cmynow['info']; ?></td>
    <td class="tc"><?php echo $cmynow['res']; ?></td>
  </tr>
  <tr class="tc">
    <td><?php lang('tools.setup_mysqlinfo',0); ?></td>
    <td class="msg"><?php echo "$_cfgs[db_user]:$_cfgs[db_pass]@$_cfgs[db_host]:$_cfgs[db_port] [$_cfgs[db_driver]]"; ?></td>
    <td class="tc">---</td>
  </tr>
    <?php if(strstr($cmynow['info'],'Unknown database')){ ?>
  <tr class="tc">
    <td><?php lang('tools.setup_nowdb',0); ?></td>
    <td class="msg">
      <input name="dbname" type="text" id="dbname" value="<?php echo $_cfgs['db_name']; ?>" class="w240" 
        onblur="chkDbname()" reg="var:3-24" tip='<?php lang('tools.setup_dbedit',0); ?><br><?php lang('tools.setup_dbrule',0); ?>' />
      <input name="dbnold" type="hidden" id="dbnold" value="<?php echo $_cfgs['db_name']; ?>" />
      <?php lang('tools.setup_dbedit',0); ?>
    </td>
    <td class="tc"><input type="submit" name="bdbedit" id="bdbedit" value="<?php lang('tools.setup_creat',0); ?>" class="btn" /></td>
  </tr>
  <tr>
    <td class="tip" colspan="3">
    <?php echo lang('tools.setup_dbnoexsists',$_cfgs['db_name']); ?>; 
    <?php lang('tools.setup_clickadd',0); ?> <?php lang('tools.setup_dbcfg',0); ?>
    <a href="?"><?php lang('tools.setup_refresh',0); ?></a></td>
  </tr> 
    <?php }else{ ?>
  <tr class="tc">
    <td><?php lang('tools.setup_nowdb',0); ?></td>
    <td class="msg">
      $_cfgs['db_name'] = '<?php echo $_cfgs['db_name']; ?>';
    </td>
    <td class="tc">---</td>
  </tr>
  <tr>
    <td class="tip" colspan="3">
    <?php lang('tools.setup_cantlink',0); ?>
    <?php lang('tools.setup_dbcfg',0); ?>, 
    <a href="?"><?php lang('tools.setup_refresh',0); ?></a>。
    </td>
  </tr> 
    <?php } ?>
  <?php }else{ ?>
  <tr id="tipdb">
    <td class="tc"><?php lang('tools.setup_tdb_tip',0); ?></td>
    <td class="note"><?php lang('tools.setup_tdb_ndb',0); ?>: `<b class="cF0F"><?php echo $_cfgs['db_name']; ?></b>` <?php lang('tools.setup_tdb_rst',0); ?>!</td>
    <td class="tc">---</td>
  </tr> 
  <tr id="step1">
    <td><?php lang('tools.setup_x1',0); ?></td>
    <td class="note">(PHP)V5.4+; (GD library)V2.0+; <a href="../adbug/check.php" target="_blank">-=&gt;<?php lang('tools.setup_view',0); ?></a><br>
    [mysqli,mysql,pdo] <?php lang('tools.setup_my31',0); ?></td>
    <td class="tc"><input name="step1" type="button" value="<?php lang('tools.setup_start',0); ?>" class="btn" onClick="setMain(1);"></td>
  </tr> 
  <tr id="step2">
    <td><?php lang('tools.setup_x2',0); ?></td>
    <td><?php lang('tools.setup_wnsecs',0); ?></td>
    <td class="tc"><input name="step2" type="button" value="<?php lang('tools.setup_wait',0); ?>" class="btn" onClick="setMain(2);"></td>
  </tr> 
  <tr id="step3">
    <td><?php lang('tools.setup_x3',0); ?></td>
    <td><?php lang('tools.setup_wnsecs',0); ?></td>
    <td class="tc"><input name="step3" type="button" value="<?php lang('tools.setup_wait',0); ?>" class="btn" onClick="setMain(3);"></td>
  </tr> 
  <tr id="step4">
    <td><?php lang('tools.setup_x4',0); ?></td>
    <td>
      <span class="right"><input type="checkbox" id="hasdd" name="hasdd" value="1" checked></span>
      <?php lang('tools.setup_demo',0); ?>
    </td>
    <td class="tc"><input name="step4" type="button" value="<?php lang('tools.setup_wait',0); ?>" class="btn" onClick="setMain(4);"></td>
  </tr> 
  <tr id="step5">
    <td><?php lang('tools.setup_x5',0); ?></td>
    <td><?php lang('tools.setup_idname',0); ?></td>
    <td class="tc"><input name="step5" type="button" value="<?php lang('tools.setup_wait',0); ?>" class="btn" onClick="setMain(5);"></td>
  </tr>
  <?php } ?>
  </table>
</div>
</form>

<div id="xform" style="display:none">
  <p><?php lang('tools.setup_setpara',0); ?></p>
  <table width="100%" border="1" class="tblist">
  <tr>
    <td class="tr"><?php lang('tools.setup_sitename',0); ?></td>
    <td class="tl"><input name="name" value="<?php echo $_cbase['sys_name']; ?>" type="text" id="name" size="24" maxlength="24" reg='str:4-24'>
    <td><?php lang('tools.setup_4_24',0); ?></td>
  </tr>
  <tr>
    <td class="tr"><?php lang('tools.setup_admid',0); ?></td>
    <td class="tl"><input name="uid" value="<?php echo $orguser; ?>" onBlur="chkIdpass(this,0)" type="text" id="uid" size="24" maxlength="24" reg='str:3-15'>
    <td><?php echo lang('tools.setup_val_letter','3~15'); ?></td>
  </tr>
  <tr>
    <td class="tr"><?php lang('tools.setup_admpw',0); ?></td>
    <td class="tl"><input name="upw" value="<?php echo $orgpass; ?>" onBlur="chkIdpass(this,1)" type="text" id="upw" size="24" maxlength="24" reg='str:6-24'>
    <td><?php echo lang('tools.setup_val_letter','6~24'); ?></td>
  </tr> 
  <tr>
    <td class="tc" colspan="2">
    <input type="button" name="button" id="button" value=" <?php lang('tools.setup_sendend',0); ?> " onClick="setStp5s(5,1)" class="btn">
    </td>
    <td width="40%">&nbsp;</td>
  </tr>
  </table>
</div>

<div class="tc" id="idLoad" style="display:none">
<?php lang('tools.setup_doing',0); ?><br>
<img src="<?php echo PATH_STATIC; ?>/icons/basic/loading.gif" style="display:none"></div>
<!--a onclick="loadShow()">show</a> <a onclick="loadStop()">stop</a-->

<div id="xinfo">
  <p><?php lang('tools.setup_title',0); ?>-<?php lang('tools.setup_dosteps',0); ?></p>
  <table width="100%" border="1" class="tblist">
  <tr id="resone" class="tc">
    <td>&nbsp;</td>
  </tr> 
  <tr>
    <td>
    <div style="width:96%; height:120px; overflow-y:scroll;" id="reinfo">
    <?php lang('tools.setup_dores',0); ?>
    </div>
    </td>
  </tr>
  </table>
</div>

<script>
<?php echo $setCfgs['jstr']; ?>
var steps = new Array('','Check','Stru','Base','Demo','Idpw');
var nowStep = 0;
setState(); 
var orgcfgs = '<?php echo "$orguser,$orgpass"; ?>'.split(',');
var simpass = ',<?php echo implode(',',read('simpass','sy')); ?>,';
var otimer = null;
</script>
<script src="../adbug/xfunc.js"></script>